<?php use_helper('Form') ?>
<?php if($greske){?>
   <p style="padding:0 0 10px 0;margin:0;">Prethodno poslate poruke:</p>
   <table class="form_holder form_list">
   <tr>
     <th><label style="font-weight: 700;">Naslov</label></th>
     <th><label style="font-weight: 700;">Tekst</label></th>
     <th><label style="font-weight: 700;">Odgovor</label></th>
     <th><label style="font-weight: 700;">Rešen</label></th>
     <th><label style="font-weight: 700;">Datum</label></th>
   </tr>
   <?php foreach($greske as $greska)
   {?>
     <tr>
       <td><?php echo link_to(mb_substr($greska, 0, 25, 'UTF-8'), 'greske/pregledGreske/?greska_id='.$greska->getId()) ?></td>
       <td><?php echo mb_substr($greska->getText(), 0, 60, 'UTF-8') ?></td>
       <td><?php echo mb_substr($greska->getOdgovor(), 0, 60, 'UTF-8') ?></td>
       <td><?php echo ($greska->getStatus() == GreskaPeer::$status['resen']) ? 'Da' : 'Ne' ?></td>
       <td><?php echo date('d.n.Y. G:i', strtotime($greska->getCreatedAt())) ?></td>
     </tr>
   <?php }?>
   </table>
<?php }?>

<?php if(isset($error)) echo "<div class='error'><ul>$error </ul></div>"; ?>

<p style="padding:15px 0 10px 0;margin:0;">Nova poruka:</p>
<form id="registrationForm" action="" method="POST">
  <table class="form_holder">
    <tr>
      <th><label class="txLabel"><?php echo __('Tip poruke:') ?></label></th>
      <td>
        <select name="tip" class="required">
          <option value=""><?php echo __('Izaberi') ?></option>
          <option value="1" <?php echo ($sf_request->getParameter('tip') == GreskaPeer::$tip['predlog']) ? 'selected="selected"' : '' ?>>&nbsp;&nbsp;&nbsp;<?php echo __('Predlog') ?></option>
          <option value="2" <?php echo ($sf_request->getParameter('tip') == GreskaPeer::$tip['greska']) ? 'selected="selected"' : '' ?>>&nbsp;&nbsp;&nbsp;<?php echo __('Greška') ?></option>
        </select>
      </td>
    </tr>
    <tr>
      <th><label class="txLabel"><?php echo __('Naslov') ?></label></th>
      <td><input name="naslov" maxlength="100" class="regInput" type="text" value="<?php echo $sf_request->getParameter('naslov') ?>"></td>
    </tr>
    <tr>
      <th><label class="txLabel"><?php echo __('Tekst') ?></label></th>
      <td><textarea style="width:400px; height: 300px;" name="text" class="regInput"><?php echo $sf_request->getParameter('text') ?></textarea></td>
    </tr>
    <tr>
      <th><label class="txLabel">&nbsp;</label></th>
      <td><a id="dugme" onclick="document.forms[0].submit(); $('#dugme').attr('disabled', 'true'); ; return false;" href="javascript: void(0)" class="button"><span>Pošalji</span></a></td>
    </tr>
  </table>
</form>